import random
money = 1000
i = 0
while True:
    a = random.randint(1, 6)
    b = random.randint(1, 6)
    c = random.randint(1, 6)
    d = int(a) + int(b) + int(c)
    guess = input("欢迎来到腾讯豆地主，请输入'大'或'小':")
    if (d < 11 and guess == '小') or (d >= 11 and guess == '大'):
        print("你赢了，恭喜你获得了100金豆")
        money += 100
        i += 1
        continue
    elif (d >= 11 and guess == '小') or (d < 11 and guess == '大'):
        print("你输了，恭喜你失去了100金豆")
        money -= 100
        i += 1
        continue
    elif (str(guess) == 'exit') or (money < 100):
        print("已退出，你还剩的豆是", money)
        print("你玩的次数是:", i)
        break
    else:
        print("请重新输入")
